

package com.narunas.view {

	import com.narunas.ApplicationFacade;
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;

	public class ApplicationMediator extends Mediator implements IMediator{
		
		
		
		// Instead of sending ADDRESS_CHANGE notifications, you could call SWFAddressProxy.requestURI(uri) 
		// directly from any Mediator. This is a design decision, and is perhaps not so important which method you choose.
		///private var mySWFAddressProxy:SWFAddressProxy;
		
		public function ApplicationMediator(mediatorName: String = null, viewComponent:Object = null) {
			super(mediatorName, viewComponent);
			///mySWFAddressProxy = facade.retrieveProxy( SWFAddressProxy.NAME ) as SWFAddressProxy;
			createEvents();
		}
		
		private function createEvents():void {
			//narunas
			//base.btnHome.addEventListener(MouseEvent.CLICK, onHome);
			//base.navigation.addEventListener("navigation_click", onNavigationClick);
		}
		
		
		private function onNavigationClick(e:Event):void {
			//trace("click");
			sendNotification(ApplicationFacade.ADDRESS_CHANGE, base.navigation.deeplink);
		}
		
		private function onHome(e:MouseEvent):void {
			base.navigation.clearNavigationStates();
			sendNotification(ApplicationFacade.ADDRESS_CHANGE, "/");
		}
	
		override public function listNotificationInterests():Array{
			return [
					ApplicationFacade.NAV_CHANGE
					];
		}
		
		override public function handleNotification(notification:INotification):void{
			super.handleNotification(notification);
			
		
			
			switch(notification.getName()) {
				
				case ApplicationFacade.NAV_CHANGE:
				break;
				
			}
		}
		
		private function get base():Sprite{
			return MainApp(app).base;
		}
		
		private function get app():MainApp {
			return viewComponent as MainApp;
		}
		
	}
	
}
;